package example;

public class Car {
    private String brand;
    private Person owner;
    public Car(String brand) {
        this.brand = brand;
    }

    public Car(String brand,Person owner){
        this.brand=brand;
        this.owner=owner;
    }

    public void setOwner(Person owner) {
        this.owner = owner;
    }
    public void printInfo(){
        System.out.println("汽车品牌："+this.brand+"，车主："+this.owner!=null?this.owner.getName():"未知");
    }
}


